<?php

namespace app\admin\controller;

use app\common\model\ShopUserMoneyRecord;
use app\common\service\Status;
use buildView\Filter;
use think\Controller;
use buildView\Grid;

/**
 * 钱包明细
 * Class MoneyRecord
 * @package app\admin\controller
 */
class MoneyRecord extends Controller
{
    /**
     * 列表
     * @auth true
     * @menu true
     * @return string
     */
    public function index()
    {
        $id = $this->request->param('id');
        $grid = new Grid(new ShopUserMoneyRecord);
        $grid->model()->where('uid',$id);
        $grid->type('类型')->using(Status::WALLETTYPE())->badge();
        $grid->title('标题');
        $grid->desc('描述');
        $grid->money('金额')->totalRow();
        $grid->create_at('使用时间');
        $grid->hideAction();
        $grid->hideAddButton();
        $grid->hideExportButton();
        $grid->hideDeletesButton();
        $grid->filter(function(Filter $filter){
            $filter->eq('type', '类型')->select(Status::WALLETTYPE());
            $filter->dateBetween('create_at','使用时间');
        });
        $grid->actions(function($action,$data){
            $action->hideDel();
            $action->hideEdit();
        });
        return $grid->view();
    }
}
